package com.grape.dp.template.controller;

import com.grape.dp.template.AbstractPayCallbackTemplate;
import com.grape.dp.template.factory.TemplateFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:TemplateController
 * @author: myx
 * @date: 2019-07-23
 * Copyright © 2019-grape. All rights reserved.
 */
@RestController
public class TemplateController {

    /**
     * 支付回调
     *
     * @return
     */
    @RequestMapping("/asyncCallBack")
    public String asyncCallBack(String templateId) {
        AbstractPayCallbackTemplate payCallbackTemplate = TemplateFactory.getPayCallbackTemplate(templateId);
        // 使用模版方法模式 执行共同的骨架
        return payCallbackTemplate.asyncCallBack();
    }

}
